<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>数据管理</title>
    <link rel="stylesheet" href="../component/pear/css/pear.css"/>
    <style>
        .file-upload {
            display: inline-block;
            position: relative;
            cursor: pointer;
            font-size: 16px;
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 5px;
            background-color: #fff;
            overflow: hidden;
        }

        .file-upload input[type=file] {
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 100%;
            opacity: 0;
            cursor: pointer;
        }

        .file-upload:hover {
            border-color: #999;
        }

        #fileName {
            pointer-events: none; /* 禁用输入框的鼠标事件 */
            border: none; /* 隐藏输入框的外框 */
            outline: none; /* 隐藏输入框的外边框 */
            color: gray;
            margin-left: 10px;
        }

         .subBtn {
             margin-right: 25px;
         }

        #btnDiv {
            display: flex;
            justify-content: center;
            align-items: center;
        }

    </style>
</head>
<body class="pear-container">
<div class="layui-row">
    <div class="layui-col-md6 layui-col-md-offset3">
        <div class="layui-card">
            <div class="layui-card-body">
                <form class="layui-form layui-form-pane" action="" enctype="multipart/form-data"
                      id="dataImportForm">
                    <div class="layui-form-item">
                        <label class="layui-form-label">Coverage id</label>
                        <div class="layui-input-block">
                            <input type="text" name="coverageId" required lay-verify="required"
                                   placeholder="请输入元数据唯一标识" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">Subtype</label>
                        <div class="layui-input-block">
                            <select id = "subtype-select" name="subtype">
                                <option value="">请选择数据类型</option>
                                <optgroup label="ISO 19163" data-group-value = "ISO_19163" >
                                    <option value="CategoricalGriddedData">CategoricalGriddedData</option>
                                    <option value="NumericalGriddedData">NumericalGriddedData</option>
                                    <option value="FusedImage">FusedImage</option>
                                    <option value="OpticalImage">OpticalImage</option>
                                    <option value="RadiometerData">RadiometerData</option>
                                    <option value="SARData">SARData</option>
                                    <option value="SimulatedImage">SimulatedImage</option>
                                </optgroup>
                                <optgroup label="ISO 19123" data-group-value = "ISO_19123">
                                    <option value="RectifiedGridCoverage">RectifiedGridCoverage</option>
                                    <option value="ReferenceableGridCoverage">ReferenceableGridCoverage</option>
                                </optgroup>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">Description</label>
                        <div class="layui-input-block">
                            <textarea name="description" placeholder="请输入元数据描述"
                                      class="layui-textarea"></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item" pane>
                        <label class="layui-form-label">Validate</label>
                        <div class="layui-input-block">
                            <input type="checkbox" name="validate" lay-skin="switch" lay-text="ON|OFF" value="0">
                        </div>
                    </div>
                    <div class="layui-form-item" pane>
                        <label class="layui-form-label">Import by</label>
                        <div class="layui-input-block">
                            <input type="radio" name="method" value="url" title="URL" checked id="defaultRadio">
                            <input type="radio" name="method" value="file" title="File">
                            <input type="radio" name="method" value="text" title="Text">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block" id="useUrl">
                            <input type="text" name="url" placeholder="请输入链接" autocomplete="off"
                                   class="layui-input">
                        </div>
                        <div class="layui-input-block layui-hide" id="useFile">
                            <label class="file-upload">
                                <span><i class="layui-icon">&#xe67c;</i>上传文件</span>
                                <input type="file" id="file" name="file">
                            </label>
                            <input id = "fileName" type="text">
                        </div>
                        <div class="layui-input-block layui-hide" id="useText">
                            <textarea name="text" placeholder="请输入元数据的 XML 文本" class="layui-textarea"></textarea>
                        </div>
                    </div>

                    <div class="layui-form-item" id="btnDiv">
                        <div>
                            <button class="pear-btn pear-btn-md pear-btn-primary subBtn" lay-submit id="submitBtn">
                                <i class="layui-icon layui-icon-ok"></i>
                                提交
                            </button>
                            <button type="reset" class="pear-btn pear-btn-md subBtn">
                                <i class="layui-icon layui-icon-refresh"></i>
                                重置
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script src="../component/layui/layui.js"></script>
<script src="../component/pear/pear.js"></script>
<script src="../js/dataImport.js"></script>
</body>

</html>